package com.itheima.controller;


import com.itheima.execption.SysException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/testException")
    public String testException() throws SysException {
        System.out.println("testException.....执行了");
        //异常模拟
        try {
            int i = 10/0;
        } catch (Exception e) {
            e.printStackTrace();
            //抛出自定义异常信息
            throw new SysException("除数为零了。。。。。");
        }
        return "success";
    }
}
